# -*- coding: iso-8859-1 -*-
__author__="Vincent"
__date__ ="$5 mars 2009 21:49:10$"

import wx
from gamecomponents import GameComponents

class Vertex:
    """
    class to implement vertex, which sit at each corner of an hex
    """
    #
    uv = ()         # hexa coordinates
    xy = ()         # cartesian coordinates
    esperance = 0       # proba value
    esperances = { GameComponents.LUMBER:0,
                    GameComponents.GRAIN:0,
                    GameComponents.BRICK:0,
                    GameComponents.ORE:0,
                    GameComponents.WOOL:0}
    hexes = 3*[0]   # 3 neighboor hexes
    hexacoord = None 
                        
    def __init__(self, uv=(0,0), esperance=0):
        self.uv = uv
        self.esperance = esperance
        self.esperances = {  GameComponents.LUMBER:0,
                            GameComponents.GRAIN:0,
                            GameComponents.BRICK:0,
                            GameComponents.ORE:0,
                            GameComponents.WOOL:0}

    def PaintValue(self, dc):
        """
        PaintValue : paint the proba value
        """
        if self.esperance != 0:
            try:
                gc = wx.GraphicsContext.Create(dc)
            except NotImplementedError:
                dc.DrawText("This build of wxPython does not support the wx.GraphicsContext "
                            "family of classes.",25, 25)
                return

            #(X,Y) coordinate
            centerX, centerY = self.hexacoord.convertUVtoXY(self.uv)

            # white circle
            dc.SetPen(wx.Pen('white', 1))
            dc.SetBrush(wx.Brush('white'))
            r = 10
            dc.DrawCircle(centerX, centerY, r)


            # text
            s = "%s" % self.esperance
            gc.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
            width, height = dc.GetTextExtent(s)
            dc.DrawText(s, centerX-width/2, centerY-height/2 )






if __name__ == "__main__":
    print "Hello";